unit SmallStruct.Form.TSSForm;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  SmallStruct.Core;

type
  TSSForm = class(TForm, ISSRuntimeObject)
  private
    _Context: ISSObjectContext;
  protected { ISSObject }
    function GetObjectInstance: TComponent;
    procedure ReleaseObjectInstance;
  public { ISSRuntimeObject }
    function GetContext: ISSObjectContext; virtual;
    procedure SetContext(AObjectContext: ISSObjectContext); virtual;
    procedure InitObject; virtual;
  public
    destructor Destroy; override;  
  end;

implementation

{$R *.dfm}

{ TSSForm }

destructor TSSForm.Destroy;
begin
  if Assigned(_Context) then
    _Context.ReleaseObjectInstance;
  inherited;
end;

function TSSForm.GetContext: ISSObjectContext;
begin
  Result := _Context;
end;

function TSSForm.GetObjectInstance: TComponent;
begin
  Result := Self;
end;

procedure TSSForm.InitObject;
begin

end;

procedure TSSForm.ReleaseObjectInstance;
begin
  Free;
end;

procedure TSSForm.SetContext(AObjectContext: ISSObjectContext);
begin
  _Context := AObjectContext;
end;

end.
